%%%-------------------------------------------------------------------
%%% File    : iter.hrl
%%% Author  :  <vjache>
%%% Description : 
%%%
%%% Created : 13 Jan 2009 by  <vjache>
%%%-------------------------------------------------------------------

%%====================================================================
%% API
%%====================================================================
%%--------------------------------------------------------------------
%% Record: iter 
%% Description: Iterator descriptor. It used to define custom iterator
%% 				for using iteration logic defined at 'iter.erl'.
%% Attributes:	param - arbitrary term passed to open fun
%%				open_fun - fun to create initial state of iterator: 
%%					fun(Param)->State.
%%				next_fun - fun to retrieve next item in iterator:
%%					fun(State)->{NewState,Item}|{NewState,'$EOF'}if exhausted.
%%				close_fun - fun to release resources of iterator if any:
%%					fun(State)->ok.
%%--------------------------------------------------------------------
-record(iter,{impl,param}).
-record(fun_set,{open_fun,next_fun,close_fun}).
-ifndef(EOF).
-define(EOF,'$EOF').
-endif.

-ifndef(REJECT_REC).
-define(REJECT_REC,'$reject').
-endif.

-define(IS_ITER(T), is_record(T,iter)).

